<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<link type="text/css" href="css/header.css" rel="stylesheet"/>
	<script type="text/javascript" src="js/header.js"></script>
</head>
<body>

	<div id="header" style="opacity: 1">
		
		<div id="header-top-container">
			<ul id="header-menu">
				<li class="showyourself-menu-item">
					<a title="Home" href="/showyourself/index.jsp">
						<span>Home</span>
					</a>
				</li>
				<li class="showyourself-menu-item">
					<a title="About Us" href="/showyourself/aboutUs.jsp">
						<span>About Us</span>
					</a>
				</li>
				<li class="showyourself-menu-item">
					<%if(session.isNew()) session.setAttribute("email", ""); %>
					<% if (!session.getAttribute("email").equals("")){%>
						<a title="Download Source" href="http://code.google.com/p/showyourself/source/browse/">
							<span>Download Source</span>
						</a>
					<%} else {%>
						<a title="Download Source"  target="_new" href="/showyourself/NotPermission.jsp">
							<span>Download Source</span>
						</a>
					<%} %>
				</li>
				<li class="showyourself-menu-item">
				 	<c:url value="application.jsp" var="engURL">
   						<c:param name="locale" value="en_US"/>
 					</c:url>
					<a title="English" href="${engURL}">
						<span> 
							<img alt="English" src="./img/gb.png" />
						</span>
					</a>
				</li>
				<li class="showyourself-menu-item">
					<a title="German" href="">
						<span> 
							<img alt="German" src="./img/at.png" />
						</span>
					</a>
				</li>
			</ul>
			<ul id="header-login">
				<li>
					<div class="login-box">
						<%@ include file="login.jsp" %>
					</div>
				</li>
			</ul>
		</div>
		
		<div id="headerbar">
			<h1>
				<a title="showyourself" href="/showyourself/index.jsp" >
					<img alt="logo" src="./img/showyourself-logo.png" />
				</a>
			</h1>
		</div>
	</div>
	
	<script>
		function success(position) {
		  var s = document.querySelector('#status');
		  
		  if (s.className == 'success') {
		    // not sure why we're hitting this twice in FF, I think it's to do with a cached result coming back    
		    return;
		  }
		  
		  s.innerHTML = "You are here";
		  s.className = 'success';
		  
		  var mapcanvas = document.createElement('div');
		  mapcanvas.id = 'mapcanvas';
		  mapcanvas.style.height = '100px';
		  mapcanvas.style.width = '400px';
		    
		  document.querySelector('article').appendChild(mapcanvas);
		  
		  var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
		  var myOptions = {
		    zoom: 15,
		    center: latlng,
		    mapTypeControl: false,
		    navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
		    mapTypeId: google.maps.MapTypeId.ROADMAP
		  };
		  var map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
		  
		  var marker = new google.maps.Marker({
		      position: latlng, 
		      map: map, 
		      title:"Your location"
		  });
		}
		
		function error(msg) {
		  var s = document.querySelector('#status');
		  s.innerHTML = typeof msg == 'string' ? msg : "failed";
		  s.className = 'fail';
		  
		  // console.log(arguments);
		}
		
		if (navigator.geolocation) {
		  navigator.geolocation.getCurrentPosition(success, error);
		} else {
		  error('not supported');
		}
	</script>
</body>
</html>